<?php


namespace addon\hotel\event;

use addon\hotel\model\HotelOrderCalc as HotelOrderCalcModel;
use app\model\hotel\Stat;


/**
 * 酒店支付后结算
 */
class HotelOrderCalc
{

    public function handle($data)
    {
        $store_model = new HotelOrderCalcModel();

        $res = $store_model->calculate($data['order_id']);
        //添加统计
        $stat = new Stat();
        $data = [
            'hotel_id' => $data['hotel_id'],
            'order_total' => $data['order_money'],
            'order_pay_count'    => 1,
            'room_pay_count'    => $data['room_num'],
        ];
        $stat->addHotelStat($data);
        return $res;
    }
}